/**
 * Created by xukj on 2018/6/8.
 */
import React from 'react';
import {
  View,
  TouchableOpacity,
  Image,
  Text,
  StyleSheet,
} from 'react-native';
import Colors from '../../constants/Colors';
import PropTypes from 'prop-types';

export default class AdCellItem extends React.PureComponent {
  render() {
    const ad = this.props.data.ad;
    return (
      <View style={{flex: 1}}>
        <TouchableOpacity style={styles.cell}>
          <Text style={styles.title}>{ad.title}</Text>
          <Image style={styles.cover} source={{uri: ad.image}} />
          <Text style={styles.content}>{ad.content}</Text>
        </TouchableOpacity>
        <View style={styles.sp} />
      </View>
    );
  }
}

AdCellItem.propTypes = {
  data: PropTypes.object,
};

const styles = StyleSheet.create({
  cell: {
    flex: 1,
    flexDirection: 'column',
    backgroundColor: 'white',
    height: 200,
    paddingLeft: 14,
    paddingRight: 14,
    justifyContent: 'center',
  },
  title: {
    height: 20,
    fontSize: 16,
    color: Colors.black01,
  },
  cover: {
    height: 120,
    backgroundColor: Colors.gray04,
    borderRadius: 4,
    marginTop: 8,
    marginBottom: 8,
  },
  content: {
    height: 20,
    fontSize: 14,
    color: Colors.gray02
  },
  sp: {
    height: 10,
    backgroundColor: Colors.gray05,
  }
});